/*
 * Copyright (c) 2013, FPX and/or its affiliates. All rights reserved.
 * Use, Copy is subject to authorized license.
 */
package pyip.lib.javalearn.locale;

import java.util.Locale;

/**
 * @author yepeng
 * @date 2015年8月26日
 */
public class LocaleDemo {
    public static void main(String[] args) {
        customerLocale();
//        displayLanguage();
    }
    
    public static void customerLocale() {
        Locale xxLocale = new Locale("xx", "XX");
        System.out.println(xxLocale.getDisplayLanguage());
        System.out.println(xxLocale.getDisplayLanguage(Locale.US));
    }

    public static void displayLanguage() {
        Locale deLocale = new Locale("de", "DE");
        Locale frLocale = new Locale("fr", "FR");
        System.out.println("default locale: " + Locale.getDefault());
        System.out.println("German language: " + deLocale.getLanguage());
        System.out.println("German displayLanguage in (default): " + deLocale.getDisplayLanguage());
        System.out.println("German displayLanguage name (German): " + deLocale.getDisplayLanguage(deLocale));
        System.out.println("German displayLanguage name (French): " + deLocale.getDisplayLanguage(frLocale));
        // 结果输出:
        // default locale: zh_CN
        // German language: de
        // German displayLanguage in (default): 德文
        // German displayLanguage name (German): Deutsch
        // German displayLanguage name (French): allemand
    }
}
